<template>
    <div class="messageDetails" v-if="item">
        <div class="mDli red" >
            <div class="mDli_l">第{{item.name}}次产检</div>
            <div class="mDli_r">{{getperiod(item.status)}}</div>
        </div>
        <div class="mDli">
            <div class="mDli_l">产检时间</div>
            <div class="mDli_r">{{timepus(item)}}</div>
        </div>
        <div class="mDli">
            <div class="mDli_l">适宜孕周</div>
            <div class="mDli_r">孕{{item.beginWeek}}-{{item.endWeek}}周</div>
        </div>
        <div class="mDlisT">
            <div class="mDli_l">产检项目</div>
            <div class="mDli_r">{{item.summary}}</div>
        </div>
        <div class="mDlis">
            <div class="mDli_l">产检提醒</div>
            <div
                class="mDli_r"
            >{{item.remind||'暂无提醒'}}</div>
        </div>
    </div>
</template>
<script>
export default {
    data() {
        return {
            isshou: "1",
            item: '',
            message: "消息",
        };
    },
    onLoad(option) {
        var _this = this;
        if (option.id) {
            _this.getList(option.id);
        }
    },
    methods: {
        timepus(time){
           if(time){
              return time.productionTime?time.productionTime.substring(0, 10):time.remindTime.substring(0, 10)
           }else{
               return ''
           }
        },
        getList(id) {
            const data = {
                pageNum: 1,
                pageSize: 1,
                id: id,
            };
            var _this = this;
            _this.$ajaxs
                .get("/mobile/v1/roundPregnant/getRoundPregnantList", data)
                .then((res) => {
                    if (res.status == 200) {
                        _this.item = Object.assign({},res.content.list[0]);
                    } else {
                        uni.showToast({
                            title: "请检查网络~",
                            icon: "none",
                        });
                    }
                })
                .catch((err) => reject(err));
        },
        getperiod(val) {
            var a = "";
            switch (val) {
                case 0:
                    a = "已过期";
                    break;
                case 1:
                    a = "已产检";
                    break;
                case 2:
                    a = "待产检";
                    break;
                case 3:
                    a = "未产检";
                    break;
                default:
                    a = "";
            }
            return a;
        },
        itemClick(itme) {
        },
    },
};
</script>

<style scoped lang="scss">
.messageDetails {
    .mDli {
        display: -webkit-box;
        display: -webkit-flex;
        display: flex;
        padding: 0 40upx;
        height: 120upx;
        line-height: 120upx;
        border-bottom: 1px solid #ddd;
        .mDli_l {
            -webkit-box-flex: 1;
            -ms-flex: 1;
            flex: 1;
            color: #333;
        }
        .mDli_r {
            -webkit-box-flex: 1;
            -ms-flex: 1;
            flex: 1;
            color: #666;
            text-align: right;
            
        }
    }
    .red {
        .mDli_l {
            color: #fa4d93;
        }
        .mDli_r {
            color: #fa4d93;
        }
    }
    .mDlisT,
    .mDlis {
        padding: 0 40upx;
        border-bottom: 1px solid #ddd;
        .mDli_l {
            height: 80upx;
            line-height: 100upx;
            color: #333;

        }
        .mDli_r {
            color: #666;
            padding-bottom: 20upx;
        }
    }
    .mDlis {
        border-bottom: none;
    }
}
</style>